package com.ruoyi.event.domain.vo;

import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.ExcelDictFormat;
import com.ruoyi.common.annotation.UserDrugInfo;
import com.ruoyi.common.annotation.UserMemberInfo;
import com.ruoyi.common.convert.ExcelDictConvert;
import lombok.Data;
import org.apache.commons.compress.utils.Lists;

import java.util.Arrays;
import java.util.Date;
import java.util.List;


/**
 * 帮扶成效视图对象 event_bf_result
 *
 * @author strongme
 * @date 2023-02-04
 */
@Data
@ExcelIgnoreUnannotated
public class EventBfResultVo implements EventInfo {

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @ExcelProperty(value = "id")
    private Long bfResultId;

    /**
     * 被帮扶人员id
     */
    @ExcelProperty(value = "被帮扶人员id")
    private Long userId;

    @UserDrugInfo
    public Object getUserInfo() {
        return userId;
    }

    /**
     * 帮扶人员id
     */
    @ExcelProperty(value = "帮扶人员id")
    private Long memberId;

    @UserMemberInfo
    public Object getMemberInfo() {
        return memberId;
    }

    /**
     * 部门或单位
     */
    @ExcelProperty(value = "部门或单位")
    private String bmdw;

    /**
     * 月收入(rmb)
     */
    @ExcelProperty(value = "月收入(rmb)")
    private Long ysr;

    /**
     * 帮扶成效
     */
    @ExcelProperty(value = "帮扶成效", converter = ExcelDictConvert.class)
    @ExcelDictFormat(dictType = "bfcx")
    private String bfcs;

    public List<String> getBfcsList() {
        if (StrUtil.isNotBlank(bfcs)) {
            return Arrays.asList(bfcs.split(","));
        }
        return Lists.newArrayList();
    }

    /**
     * 图片
     */
    @ExcelProperty(value = "图片")
    private String img;

    /**
     * 备注
     */
    @ExcelProperty(value = "备注")
    private String remark;

    private Date createTime;
    private Date updateTime;


    @Override
    public Long getId() {
        return bfResultId;
    }

    @Override
    public String getText() {
        return bfcs;
    }

    @Override
    @JsonFormat(pattern = "yyyy-MM-dd")
    public Date getTime() {
        return createTime;
    }
}
